package com.gubei.subject.common.enums;

import lombok.Getter;

/**
 * 分類タイプのEnum定義
 */
@Getter
public enum CategoryTypeEnum {
    PRIMARY(1,"大分類"),
    SECOND(2,"2級分類");

    public int code;
    public String desc;

    CategoryTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static CategoryTypeEnum getByCode(int codeVal) {
        for (CategoryTypeEnum categoryTypeEnum : CategoryTypeEnum.values()) {
            if(categoryTypeEnum.code == codeVal) {
                return categoryTypeEnum;
            }
        }
        return null;
    }
}
